﻿using System;
using System.Drawing;
using System.Windows.Media.Imaging;
using GemCase.Misc;
using GemCase.Properties;
using ReactiveUI;

namespace GemCase.Model
{
    public class EditViewModel:ReactiveObject
    {

        private Image _imageToBeEdit;
        private EditViewModel _motherViewModel;
        private Bitmap _background;

        public EditViewModel(Image imageToBeEdit, EditViewModel motherViewModel)
        {
            _imageToBeEdit = imageToBeEdit;
            this._motherViewModel = motherViewModel;
        }

        public EditViewModel()
        {
            ForTesting();
        }

        public void Commit(Image image) { }

        public void ZoomIn() { }
        public void ZoomOut() { }

        private void ForTesting()
        {
           Elements.Add(new ImgElement()
           {
               Bitmap = Resources.face
           });
            Elements.Add(new ImgElement()
            {
                Bitmap = Resources.Saber
            });
        }

        //UI
        public ReactiveList<ImgElement> Elements { get; set; } = new ReactiveList<ImgElement>();

        public BitmapImage Background => _background.ToBitmapImage();

        private ImgElement _elementSelected;
        public ImgElement ElementSelected
        {
            get => _elementSelected;
            set => this.RaiseAndSetIfChanged(ref _elementSelected, value); 
        }
    }
}
